<?php
session_start();	
	
include "./public/common/config.php";

if($_POST){
	print_r($_POST);
	$username = $_POST['username'];
	$password = md5($_POST['password']);
	
	$sql = "select * from user where username = '{$username}' and password = '{$password}'";
	$res = mysql_query($sql);
	$row = mysql_fetch_assoc($res);
	if($row){
		$_SESSION['home_username'] = $username;
		$_SESSION['home_userid'] = $row['id'];
		echo '<script>location="index.php"</script>';
	}else{
		echo '<script>alert("用户名或密码有误")</script>';
		echo '<script>location="index.php"</script>';
	}
}
?>